package app.kotlin_1.fragment

import android.os.Bundle
import android.support.v4.app.Fragment
import android.support.v7.widget.GridLayoutManager
import android.support.v7.widget.StaggeredGridLayoutManager
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import app.kotlin_1.R
import app.kotlin_1.adapter.HomeNewGameAdapter
import app.kotlin_1.bean.GameBean
import app.kotlin_1.utils.e
import kotlinx.android.synthetic.main.fragment_date.view.*

/**
 * Created by 刘智强 on 2017/9/25.
 */
class DataFragment : Fragment() {
    private val gameList = mutableListOf<GameBean>()
    var rootView: View? = null
    override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View? {
        rootView = inflater?.inflate(R.layout.fragment_date, container, false)
        initData()
        return rootView
    }

    private fun initData() {
        for (i in 0..8) {
            gameList.add(GameBean("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1505888477527&di=40719d4c0453c8ef489d314cdb2772b0&imgtype=0&src=http%3A%2F%2Fimg.18183.com%2Fuploads%2F170901%2F154-1FZ1155RC18.jpg", "重返部落"))
        }
        rootView?.rvData?.layoutManager = StaggeredGridLayoutManager(4, StaggeredGridLayoutManager.VERTICAL)
        rootView?.rvData?.isNestedScrollingEnabled = false
        rootView?.rvData?.adapter = HomeNewGameAdapter(activity, gameList)

    }

}